﻿function EncodeContent(stringInput) {
//Undone : xet lai bieu thuc nhap vao bo dau duoi, khoang trang tab ...
    stringInput = stringInput.replace(/^(<br>)+/g, "")
    stringInput = stringInput.replace(/(<br>){3,}/g, "<br><br>");
    stringInput = stringInput.replace(/((<br>)*(&nbsp;)*\s*)*$/g, "")
    stringInput = stringInput.replace(/<br>/g, "\\n");
    return stringInput;
}

function DecodeContent(stringInput) {
    stringInput = stringInput.replace(/(&lt;)/g, '<')
                                    .replace(/(&gt;)/g, '>')
                                    .replace(/(&amp;)/g, '&')
                                    .replace(/\n/g, "<br>");
    return stringInput;
}